﻿<%@ Page Language="C#" MasterPageFile="~/default.master" AutoEventWireup="true" CodeFile="ProductList.aspx.cs"
    Inherits="ProductList" %>

<%@ Register Src="~/controls/ctrlSearchInCategory.ascx" TagName="ctrlSearchInCategory"
    TagPrefix="ctrl" %>
<%@ Register Src="~/controls/ctrlQuickSearch.ascx" TagName="ctrlQuickSearch" TagPrefix="ctrl" %>
<%@ Register Src="~/controls/ctrlPageSwitch.ascx" TagName="ctrlPageSwitch" TagPrefix="ctrl" %>
<%@ Register Src="controls/ctrlProductsToCompare.ascx" TagName="ctrlProductsToCompare"
    TagPrefix="uc2" %>
<%@ Register Src="controls/ctrlProductCompareManager.ascx" TagName="ctrlProductCompareManager"
    TagPrefix="uc2" %>
<%@ Register Src="controls/ctrlRates.ascx" TagName="ctrlRates" TagPrefix="uc1" %>
<asp:Content ContentPlaceHolderID="cphMain" runat="Server">
    <table width="100%">
        <tr>
            <td>
                <h2>
                    <%= CategoryName%>
                </h2>
                <%if (CategoryID > 0)
                  { %>
                <div id="categoryListDiv" runat="server">
                    <div id="category-list">
                        <h1>
                            <%=Resources.Language.Subcategories %>:</h1>
                        <asp:Repeater ID="category" runat="server">
                            <ItemTemplate>
                                <div class="categoryItem">
                                    <a href="<%# Eval("Url") %>">
                                        <%# Eval("Text") %>
                                    </a>
                                </div>
                            </ItemTemplate>
                        </asp:Repeater>
                        <div class="clear">
                        </div>
                    </div>
                </div>
                <asp:UpdatePanel ID="upProducers" runat="server">
                    <ContentTemplate>
                        <div id="producersListDiv" runat="server" visible="false">
                            <div id="producers-list">
                                <h1>
                                    <%=Resources.Language.Producers %>:</h1>
                                <div class="producerItem">
                                    <a href='<%=CategoryID%>,1,0,<%=Resources.Language.Category.ToLower() %>.aspx'>
                                        <%=Resources.Language.All %>
                                    </a>
                                </div>
                                <asp:Repeater ID="rpProducers" runat="server">
                                    <ItemTemplate>
                                        <div class="producerItem">
                                            <a href='<%=CategoryID%>,1,0,<%# Eval("IDproducer") %>,<%=Resources.Language.Category.ToLower() %>.aspx'>
                                                <%# Eval("Name") %>
                                            </a>
                                        </div>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <% }  %>
                <div id="searchBox">
                    <ctrl:ctrlSearchInCategory ID="searchControl" runat="server" Visible="true" />
                </div>
                <div id="product-list">
                    <h1>
                        <%=Resources.Language.Products %>:</h1>
                    <div id="products-on-page">
                        <asp:Label ID="lblProductsOnPage" runat="server" Text='<%$ Resources:Language,ProductsOnPage %>'></asp:Label>
                        <asp:DropDownList ID="ddlProductsOnPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlProductsOnPage_SelectedIndexChanged">
                            <asp:ListItem>10</asp:ListItem>
                            <asp:ListItem>20</asp:ListItem>
                            <asp:ListItem>30</asp:ListItem>
                            <asp:ListItem>50</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div id="product-count">
                        <asp:Label ID="lblProductCount" runat="server" Text=""></asp:Label>
                    </div>
                    <div id="page-switch">
                        <div id="page-change" class="left">
                            <ctrl:ctrlPageSwitch ID="ctrlPageSwitch" runat="server" />
                        </div>
                        <div id="pageSort" runat="server" class="right">
                            <span>
                                <%=Resources.Language.PriceSorting %>: </span><a runat="server" id="aPriceDec" href=""
                                    class="sort">
                                    <%=Resources.Language.Decreasing %></a> <a runat="server" id="aPriceInc" href=""
                                        class="sort">
                                        <%=Resources.Language.Increasing %></a> <span>|
                                            <%=Resources.Language.NameSorting %>: </span><a runat="server" id="aNameInc" href=""
                                                class="sort">A -> Z</a> <a runat="server" id="aNameDec" href="" class="sort">Z -> A</a>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <asp:Repeater ID="rpProducts" runat="server" OnItemCreated="rpProducts_ItemCreated">
                        <ItemTemplate>
                            <div class="product-list-item">
                                <table>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <a href="<%#Eval("IDproduct") %>,<%=Resources.Language.Product.ToLower() %>,<%#URLParser.ParseUrl(Eval("Name").ToString()) %>.aspx">
                                                    <asp:Image ID="imgMiniature" runat="server" />
                                                </a>
                                            </td>
                                            <td>
                                                <div class="name">
                                                    <%#(bool)Eval("Promoted")==true?"<span style='color:Red;'>"+Resources.Language.Promoted+"</span><br />":string.Empty %>
                                                    <a href="<%#Eval("IDproduct") %>,<%=Resources.Language.Product.ToLower() %>,<%#URLParser.ParseUrl(Eval("Name").ToString()) %>.aspx">
                                                        <%# Eval("Name") %>
                                                    </a>
                                                    <br />
                                                    <uc1:ctrlRates ID="ctrlRates" runat="server" ProductID='<%#Eval("IDproduct") %>' />
                                                </div>
                                                <p>
                                                    <%# Eval("ShortDescription").ToString() %>
                                                </p>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <div class="price">
                                    <%=Resources.Language.Price %>: <strong>
                                        <%=Resources.Language.Currency %>
                                        <%# Eval("SpecialOfferPriceBrutto") != null ? Eval("SpecialOfferPriceBrutto") : Eval("PriceBrutto") %>
                                    </strong>&nbsp <span style="text-decoration: line-through; color: Red;">
                                        <%# Eval("SpecialOfferPriceBrutto") != null ? Resources.Language.Currency + " " + Eval("PriceBrutto") : ""%>
                                    </span>| <a href="#" onclick="addToBasket(<%# Eval("IDproduct") %>);return false">
                                        <%=Resources.Language.AddToBasket %></a> |
                                    <uc2:ctrlProductCompareManager ID="pcmSelectedProducts" runat="server" OnSelectedProductsChanged="pcmSelectedProducts_Changed"
                                        ProductID='<%# Eval("IDproduct") %>' />
                                </div>
                            </div>
                        </ItemTemplate>
                    </asp:Repeater>
                    <asp:Panel ID="pnlView" Visible="false" runat="server">
                    </asp:Panel>
                </div>
            </td>
        </tr>
    </table>
</asp:Content>
